package com.icexxx.icemock.mock;

import cn.hutool.core.util.RandomUtil;

public class StrMock implements IceMock {

	@Override
	public String mock(Integer minVal, Integer maxVal, Integer minWidth, Integer maxWidth, String enums,
			String key) {
		if(minWidth == null) {
			minWidth = 5;
		}
		if(maxWidth == null) {
			maxWidth = 5;
		}
		int width = RandomUtil.randomInt(minWidth, maxWidth + 1);
		if ("str".equals(key)) {
			String baseStr = RandomUtil.BASE_CHAR;
			return RandomUtil.randomString(baseStr, width);
		}
		if ("STR".equals(key)) {
			String baseStr = RandomUtil.BASE_CHAR.toUpperCase();
			return RandomUtil.randomString(baseStr, width);
		}
		if ("Str".equals(key)) {
			String baseStr = RandomUtil.BASE_CHAR + RandomUtil.BASE_CHAR.toUpperCase();
			return RandomUtil.randomString(baseStr, width);
		}
		if ("st1".equals(key)) {
			return RandomUtil.randomStringLowerWithoutStr(width, "");
		}
		if ("ST1".equals(key)) {
			return RandomUtil.randomStringLowerWithoutStr(width, "").toUpperCase();
		}
		if ("St1".equals(key)) {
			return RandomUtil.randomString(width);
		}
		return RandomUtil.randomString(width);
	}

}
